package com.anytrek.demomqtt.controller;

import com.anytrek.demomqtt.service.MQTTService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/mqtt")
public class MQTTController {

    @Autowired
    private MQTTService mqttService;

    // http://localhost:8080/mqtt/send?message=HelloWorld
    @GetMapping("/send")
    public String sendMessage(@RequestParam("message") String message) {
        mqttService.send(message);
        return "success";
    }
}